package org.logic.linguisticSummaries.type21summaries;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;

import org.logic.fuzzysets.AFuzzySet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SummaryTypeTwoOneContainer {

	private static Logger logger = LoggerFactory.getLogger(SummaryTypeTwoOneContainer.class);

	protected List<AFuzzySet> quantifiers;
	protected List<AFuzzySet> summarizers;
	
	public SummaryTypeTwoOneContainer() {
		
		quantifiers = new ArrayList<AFuzzySet>();
		summarizers = new ArrayList<AFuzzySet>();
	}

	public void addQuantifier(AFuzzySet quantifier) {
		quantifiers.add(quantifier);
	}
	
	public void addSummarizer(AFuzzySet summarizer) {
		summarizers.add(summarizer);
	}
	
	public Map<Double,String> generateAllSummaries() {
		
		logger.info("\n============================ TYPE 21 ============================");
		Map<Double,String> summaries = new TreeMap<Double,String>();		
	
		for (AFuzzySet quantifier : quantifiers) {
				for (AFuzzySet summarizer : summarizers) {
	
					SummaryTypeTwoOne summaryTypeTwoOne = new SummaryTypeTwoOne(summarizer.getSubject(),summarizer.getQualifier().getSubject(), quantifier, summarizer);
					String summary = summaryTypeTwoOne.generateSummary();
					summaries.put(summaryTypeTwoOne.getDegreeOfTruth(),summary);
					//logger.info(summary);
				}
				
	}
		return summaries;
	}

	public Map<String,Double> generateAllSummariesO() {
		
		logger.info("\n============================ TYPE 21 ============================");
		Map<String,Double> summaries = new TreeMap<String,Double>();		
	
		for (AFuzzySet quantifier : quantifiers) {
				for (AFuzzySet summarizer : summarizers) {
	
					SummaryTypeTwoOne summaryTypeTwoOne = new SummaryTypeTwoOne(summarizer.getSubject(),summarizer.getQualifier().getSubject(), quantifier, summarizer);
					String summary = summaryTypeTwoOne.generateSummary();
					summaries.put(summary,summaryTypeTwoOne.getDegreeOfTruth());
					//logger.info(summary);
				}
				
	}
		return summaries;
	}


	
}
